package cn.kgc.takemanager01.controller;

import cn.kgc.takemanager01.pojo.Product;
import cn.kgc.takemanager01.pojo.ResultEntity;
import cn.kgc.takemanager01.service.ProductService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author shkstart
 * @create 郭祥伟
 */
@CrossOrigin("*")
@RestController
public class ProductController {
    @Resource
    ProductService productService;
    @RequestMapping("/getList")
    @ApiOperation("查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "id"),
            @ApiImplicitParam(name = "productname",value = "名称"),
    })
    public ResultEntity<List<Product>> getProductList(){
        List<Product> productList=productService.selectAll();
        return ResultEntity.successWithoutData(productList);
    }
}
